package com.rental.houses.client;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rental.common.result.AjaxResult;
import com.rental.model.entity.house.SubletHourse;
import com.rental.model.form.house.SubletHouseAddForm;
import com.rental.model.form.house.SubletHousePageForm;
import com.rental.model.vo.house.SubletHouseInfoVo;
import com.rental.model.vo.house.SubletHousePageVo;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "house-server")
public interface SubletHouseFeignClient {

    /**
     * 转租房屋页面
     *
     * @param page                当前页码
     * @param size                每页条数
     * @param subletHousePageForm 查询条件
     * @return 转租房屋页面
     */
    @PostMapping("/sublet-hourse/getSubletHousePage/{page}/{size}")
    AjaxResult<Page<SubletHousePageVo>> getSubletHousePage(@PathVariable("page") Integer page,
                                                           @PathVariable("size") Integer size,
                                                           @RequestBody SubletHousePageForm subletHousePageForm);

    /**
     * 转租房屋详情
     *
     * @param id  转租屋id
     * @param uid 用户id
     * @return 转租屋详情
     */
    @GetMapping("/sublet-hourse/{id}/{uid}")
    AjaxResult<SubletHouseInfoVo> getSubletHouseInfoById(@PathVariable("id") Long id, @PathVariable("uid") Long uid);

    /**
     * 获取联系微信
     *
     * @param id 转租屋id
     * @return 联系微信
     */
    @GetMapping("/sublet-hourse/getContactWechat/{id}")
    AjaxResult<String> getContactWechat(@PathVariable("id") Long id);

    /**
     * 获取联系电话
     *
     * @param id 转租屋id
     * @return 联系电话
     */
    @GetMapping("/sublet-hourse/getContactPhone/{id}")
    AjaxResult<String> getContactPhone(@PathVariable("id") Long id);

    /**
     * 下架房屋
     *
     * @param id  转租屋id
     * @param uid 用户id
     * @return 下架房屋
     */
    @GetMapping("/sublet-hourse/downHouse/{id}/{uid}")
    AjaxResult<Boolean> downHouse(@PathVariable("id") Long id, @PathVariable("uid") Long uid);

    /**
     * 发布转租房屋
     *
     * @param subletHouseAddForm 转租房屋表单
     * @return 是否发布成功
     */
    @PostMapping("/sublet-hourse/addSubletHouse")
    AjaxResult<Boolean> addSubletHouse(@RequestBody SubletHouseAddForm subletHouseAddForm);

    /**
     * 删除房屋
     *
     * @param id  房屋id
     * @param uid 用户id
     * @return 删除结果
     */
    @DeleteMapping("/sublet-hourse/{id}/{uid}")
    AjaxResult<Boolean> deleteSubletHouse(@PathVariable("id") Long id, @PathVariable("uid") Long uid);

    /**
     * 获取当前用户的所有转租房屋信息
     *
     * @param uid
     * @return
     */
    @GetMapping("/sublet-hourse/getSubletHouseListByUid/{uid}")
    public AjaxResult<List<SubletHourse>> getSubletHouseListByUid(@PathVariable("uid") Long uid);

    /**
     * 收藏转租房屋
     *
     * @param id  房屋id
     * @param uid 用户id
     * @return 收藏结果
     */
    @GetMapping("/sublet-hourse/collect/{id}/{uid}")
    AjaxResult<Boolean> collectHouse(@PathVariable("id") Long id, @PathVariable("uid") Long uid);

    /**
     * 取消收藏转租房屋
     *
     * @param id  房屋id
     * @param uid 用户id
     * @return 取消收藏结果
     */
    @DeleteMapping("/sublet-hourse/collect/{id}/{uid}")
    AjaxResult<Boolean> cancelCollectHouse(@PathVariable("id") Long id, @PathVariable("uid") Long uid);

    /**
     * 根据id获取转租房屋简介
     *
     * @param id    转租房屋id
     * @param state 是否隐藏下架信息 1：隐藏 0：不隐藏
     * @return 转租房屋简介
     */
    @GetMapping("/sublet-hourse/getSubletHousePageVo/{id}/{state}")
    AjaxResult<SubletHousePageVo> getSubletHousePageVo(@PathVariable("id") Long id, @PathVariable("state") Integer state);

    /**
     * 获取有效转租房源数
     *
     * @return 有效转租房源数
     */
    @GetMapping("/sublet-hourse/getCount")
    AjaxResult<Long> getCount();

    /**
     * 举报转租房屋
     *
     * @param id     转租屋id
     * @param userId 用户id
     * @return 举报后的房屋举报数
     */
    @GetMapping("/sublet-hourse/accusation/{id}/{userId}")
    AjaxResult<Integer> accusation(@PathVariable("id") Long id, @PathVariable("userId") Long userId);
}
